package com.yjc.drygoods.ware.service.impl;

import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yjc.common.utils.PageUtils;
import com.yjc.common.utils.Query;

import com.yjc.drygoods.ware.dao.OldTimersDao;
import com.yjc.drygoods.ware.entity.OldTimersEntity;
import com.yjc.drygoods.ware.service.OldTimersService;
import org.springframework.util.StringUtils;


@Service("oldTimersService")
public class OldTimersServiceImpl extends ServiceImpl<OldTimersDao, OldTimersEntity> implements OldTimersService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<OldTimersEntity> queryWrapper = new QueryWrapper<>();
        String spuName = (String) params.get("spuName");
        if (!StringUtils.isEmpty(spuName)) {
            queryWrapper.like("spu_name", spuName);
        }
        IPage<OldTimersEntity> page = this.page(
                new Query<OldTimersEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}